///@Description(描述)     404页面未找到
///@author(作者)          zhangyinhong
///@create(时间)          2025-01-22 15:30

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:app_core/app_core.dart';
import 'package:yh_core_flutter_project/project/common/constant/colors.dart';
import 'package:yh_core_flutter_project/project/common/constant/styles.dart';
import 'package:yh_core_flutter_project/project/router/app_routers.dart';


class NotFoundPage extends StatelessWidget {
  const NotFoundPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar('页面未找到'),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(
              Icons.error_outline,
              size: 120.rs,
              color: AppColor.textSecondary,
            ),
            SizedBox(height: 24.hs),
            Text(
              '404',
              style: AppStyles.s48.copyWith(
                fontWeight: FontWeight.bold,
                color: AppColor.textSecondary,
              ),
            ),
            SizedBox(height: 16.hs),
            Text(
              '页面不存在',
              style: AppStyles.s16.copyWith(
                color: AppColor.textSecondary,
              ),
            ),
            SizedBox(height: 8.hs),
            Text(
              '请检查页面地址是否正确',
              style: AppStyles.s14.copyWith(
                color: AppColor.textHint,
              ),
            ),
            SizedBox(height: 40.hs),
            AppButton(
              onTap: () {
                Get.offAllNamed(AppRouters.mainTab.name);
              },
              width: 200.ws,
              child: Text(
                '返回首页',
                style: AppStyles.s16.copyWith(color: Colors.white),
              ),
            ),
            
            SizedBox(height: 16.hs),
            
            // 返回上一页按钮
            TextButton(
              onPressed: () {
                if (Navigator.canPop(context)) {
                  Get.back();
                } else {
                  Get.offAllNamed(AppRouters.mainTab.name);
                }
              },
              child: Text(
                '返回上一页',
                style: AppStyles.s14.copyWith(
                  color: AppColor.primary,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}